using System;

using Jeffrey.XFramework.XCrawl;

namespace Jeffrey.XFramework
{
    public abstract class PostFetcher : Processor
    {
        public PostFetcher(String name, String description, String classname, String path)
            : base(name, description, classname, path, null) { }
        public PostFetcher(String name, String description, String classname, String path, Filter filter)
            : base(name, description, classname, path, filter) { }

        protected abstract void PostFetch(CrawlUri uri);

        protected override sealed void innerProcess(CrawlUri uri)
        {
            try
            {
                PostFetch(uri);
            }
            catch (NullReferenceException)
            {
                uri.m_Status = CrawlUri.StatusCode.E_PostFetch;
            }
            catch (StackOverflowException)
            {
                uri.m_Status = CrawlUri.StatusCode.E_PostFetch;
            }
        }
        protected override void innerRejectProcess(CrawlUri curi)
        {
            /*
             * by default do nothing...
             */
        }
    }
}
